import * as constants from './constants'
import { fromJS } from 'immutable'
const defaultState = fromJS({
    focuesd: false,
    list: [],
    page: 0,
    totalPage: 1,
    mousIn: false
});
export default (state = defaultState, action) => {
    if (action.type === constants.search_focus) {
        return state.set('focuesd', true)
    }
    if (action.type === constants.search_Blurd) {
        return state.set('focuesd', false)
    }
    if (action.type === constants.header_List) {
        return state.set('list', action.data).set('totalPage', action.totalPage)
    }
    if (action.type === constants.mouse_Enter) {
        return state.set('mousIn', true)
    }
    if (action.type === constants.Mouse_Leave) {
        return state.set('mousIn', false)
    }
    if (action.type === constants.Change_Page) {
        return state.set('page', action.page)
    }
    return state
}
